package com.appspot.remoteobjects.argo;

import java.util.ArrayList;
import java.util.List;

public class Class extends ArrayList {
	
	String name;
	
	Package myPackage;
	List<Field> fields;
	List<Method> methods;
	List<Association> associations;

	Class superClassFromModel;
	java.lang.Class superClassFromOtherPackage;
	
	public Class()
	{
	}
	
	public Package getPackage()
	{
		return myPackage;
	}
	
	public List<Association> getAssociations() {
		if (associations == null) associations = new ArrayList<Association>();
		return associations;
	}

	public void setAssociations(List<Association> associations) {
		this.associations = associations;
	}
	
	public List<Field> getFields()
	{
		if (fields == null) fields = new ArrayList<Field>();
		return fields;
	}
	
	public List<Method> getMethods()
	{
		if (methods == null) methods = new ArrayList<Method>();
		return methods;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setPackage(Package myPackage) {
		this.myPackage = myPackage;
	}

	public void setFields(List<Field> fields) {
		this.fields = fields;
	}

	public void setMethods(List<Method> methods) {
		this.methods = methods;
	}

	public Class getSuperClassFromModel() {
		return superClassFromModel;
	}

	public void setSuperClassFromModel(Class superClassFromModel) {
		this.superClassFromModel = superClassFromModel;
	}

	public java.lang.Class getSuperClassFromOtherPackage() {
		return superClassFromOtherPackage;
	}

	public void setSuperClassFromOtherPackage(
			java.lang.Class superClassFromOtherPackage) {
		this.superClassFromOtherPackage = superClassFromOtherPackage;
	}
	
	public boolean hasSuperClass()
	{
		return superClassFromModel != null || superClassFromOtherPackage != null;
	}
	
	public String getSuperClassFullName()
	{
		String fullname = "";
		
		if (superClassFromModel != null)
		{
			Class superclass = superClassFromModel;
			fullname = superclass.getPackage().getName() + "." + superclass.getName();
		}
		else if (superClassFromOtherPackage != null)
		{
			java.lang.Class superclass = superClassFromOtherPackage;
			
			fullname += superclass.getName();
		}
		
		return fullname;
	}
}
